import httpAxios from '../utils/httpAxios'

// 获取验证码
export const getcaptcha = () => {
    return httpAxios.get('/getcaptcha')
}

// 登录
export const login = (data: object) => {
    return httpAxios.post('/login', data)
}

// 注册
export const register = (data: object) => {
    return httpAxios.post('/register', data)
}

// 获取左侧数据
export const getleftlist = () => {
    return httpAxios.get('/list')
}

// 获取右侧数据
export const getrightlist = (id: number) => {
    return httpAxios.post('/list/right', { id })
}

// 获取某一条数据
export const getitemlist = (id: number) => {
    return httpAxios.post('/list/item', { id })
}

// 获取所有的数据
export const getalllist = () => {
    return httpAxios.get('/alllist')
}

// 获取购物车数据
export const getcarlist = () => {
    return httpAxios.post('/getcarlist')
}

// 添加购物车
export const addcarlist = (data: object) => {
    return httpAxios.post('/addcar', data)
}

// 加加
export const addnums = (name: string) => {
    return httpAxios.post('/addnums', { name })
}

// 减减
export const jiannums = (name: string) => {
    return httpAxios.post('/jiannums', { name })
}

// 搜索
export const search = (name: object) => {
    return httpAxios.post('/search', {name})
}